package cn.xiaolang.issue.support;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author fuhw/Dean
 * @date 2020-11-03
 */
@Slf4j
public class MemOutOfSample {
    public static int _20MB = 20 * 1 >> 20;
    private static List<Object> data = new ArrayList<>();

    public static void main(String[] args) {
        int index=1;
        try {
            while (true) {
                index++;
                data.add( new BigObj(index,new byte[_20MB]));
            }
        } catch (Exception e) {
           log.error("size:{},exception:",data.size(),e);
        }
    }

    @Data
    @AllArgsConstructor
    static class BigObj{
        private int index;
        private byte[] bytes;
    }
}
